// PointsService.java (接口)
package com.bjtu.ptsite.service;

import com.bjtu.ptsite.exception.InsufficientPointsException;
import com.bjtu.ptsite.exception.UserNotFoundException;

/**
 *
 * @author Zehao Wang, Junjie Zhang, Yutao Wei
 *
 */
public interface PointsService {
    /**
     * 积分兑换上传流量
     * 
     * @param userId 用户ID
     * @param points 消耗积分值
     * @throws InsufficientPointsException 积分不足异常
     * @throws UserNotFoundException       用户不存在异常
     */
    void exchangePoints(int userId, int points)
            throws InsufficientPointsException, UserNotFoundException;

    /**
     * 用户获取积分（例如用户通过每日登录等任务获取积分）
     * 
     * @param userId 用户ID
     * @param points 获取积分值
     * @throws UserNotFoundException 用户不存在异常
     */
    void receivePoints(int userId, int points)
            throws UserNotFoundException;

    /**
     * 扣除一定积分
     * @param userId 用户ID
     * @param points 获取积分值
     */
    void deductPoints(int userId, int points);
}